class UsuariosController < ApplicationController
  active_scaffold :usuario do |config|
    config.label = "Usuários"
    config.theme = :blue
    
    config.create.columns = [:tipousuario, :email, :login, :nome, :senha]
    config.update.columns = [:tipousuario, :email, :login, :nome, :senha]
    config.list.columns = [:tipousuario, :email, :login, :nome, :pass] 
    
    config.columns.add :pass
    
    config.columns[:tipousuario].ui_type = :select
    
    config.create.link.label = "NOVO"
    config.search.link.label = "BUSCA"
    config.show.link.label = "Detalhes"
    config.delete.link.label = "Apagar"
    config.delete.link.confirm = "Apagar?"
  end

  protected
  def before_update(record,senha)
    @senha = record.senha
  end
  
  def before_save(record,senha)
    record.senha = @senha
  end
end
